import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        System.out.println(fun(n));

        n = input.nextInt();
        System.out.println(add(n));

    }

    public static int fun(int n) {
        if (n == 1) {
            return 1;
        }
        return n * fun(n - 1);
    }
    public static int add(int n) {
        if (n == 1) {
            return 1;
        }
        return n + add(n - 1);
    }
}
